package com.wxzhou.wangzhuan.entity;

/**
 * 提现渠道枚举
 */
public enum WithdrawalChannel {
    /**
     * 三方支付
     */
    THIRD_PARTY(1, "三方支付"),
    
    /**
     * 微信官方
     */
    WECHAT(2, "微信官方"),
    
    /**
     * 支付宝官方
     */
    ALIPAY(3, "支付宝官方"),
    
    /**
     * 银行卡
     */
    BANK_CARD(4, "银行卡");

    private final int code;
    private final String description;

    WithdrawalChannel(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static WithdrawalChannel fromCode(int code) {
        for (WithdrawalChannel channel : WithdrawalChannel.values()) {
            if (channel.getCode() == code) {
                return channel;
            }
        }
        throw new IllegalArgumentException("Unknown withdrawal channel code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}